home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / WINDOWS / TIME.ZIP / TIME.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-02-02  |  6.9 KB  |  222 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Network Time Protocol Demonstration"
  5.    ClientHeight    =   3825
  6.    ClientLeft      =   1560
  7.    ClientTop       =   1485
  8.    ClientWidth     =   7590
  9.    Height          =   4230
  10.    Left            =   1500
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3825
  15.    ScaleWidth      =   7590
  16.    Top             =   1140
  17.    Width           =   7710
  18.    Begin VB.CommandButton Command2 
  19.       Caption         =   "Command2"
  20.       Height          =   375
  21.       Left            =   2640
  22.       TabIndex        =   7
  23.       Top             =   3240
  24.       Width           =   4575
  25.    End
  26.    Begin VB.Timer Timer1 
  27.       Interval        =   1000
  28.       Left            =   1320
  29.       Top             =   2520
  30.    End
  31.    Begin VB.TextBox Text4 
  32.       BeginProperty Font 
  33.          name            =   "Arial"
  34.          charset         =   0
  35.          weight          =   400
  36.          size            =   12
  37.          underline       =   0   'False
  38.          italic          =   0   'False
  39.          strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   495
  42.       Left            =   2640
  43.       TabIndex        =   2
  44.       TabStop         =   0   'False
  45.       Top             =   1800
  46.       Width           =   4575
  47.    End
  48.    Begin VB.CommandButton Command1 
  49.       Caption         =   "Get Time"
  50.       Height          =   495
  51.       Left            =   2640
  52.       TabIndex        =   3
  53.       Top             =   2640
  54.       Width           =   4575
  55.    End
  56.    Begin VB.TextBox Text1 
  57.       BeginProperty Font 
  58.          name            =   "Arial"
  59.          charset         =   0
  60.          weight          =   400
  61.          size            =   12
  62.          underline       =   0   'False
  63.          italic          =   0   'False
  64.          strikethrough   =   0   'False
  65.       EndProperty
  66.       Height          =   495
  67.       Left            =   2640
  68.       TabIndex        =   0
  69.       Top             =   360
  70.       Width           =   4575
  71.    End
  72.    Begin GethostLibCtl.GetAdrs GetAdrs1 
  73.       Left            =   120
  74.       Top             =   2520
  75.       _Version        =   262144
  76.       _ExtentX        =   847
  77.       _ExtentY        =   847
  78.       _StockProps     =   0
  79.    End
  80.    Begin TimeLibCtl.Time Time1 
  81.       Left            =   720
  82.       Top             =   2520
  83.       _Version        =   262144
  84.       _ExtentX        =   847
  85.       _ExtentY        =   847
  86.       _StockProps     =   0
  87.    End
  88.    Begin VB.Label Label3 
  89.       Alignment       =   2  'Center
  90.       BeginProperty Font 
  91.          name            =   "Courier New"
  92.          charset         =   0
  93.          weight          =   400
  94.          size            =   12
  95.          underline       =   0   'False
  96.          italic          =   0   'False
  97.          strikethrough   =   0   'False
  98.       EndProperty
  99.       Height          =   375
  100.       Left            =   240
  101.       TabIndex        =   8
  102.       Top             =   3240
  103.       Width           =   2055
  104.    End
  105.    Begin VB.Label Label5 
  106.       BorderStyle     =   1  'Fixed Single
  107.       BeginProperty Font 
  108.          name            =   "Arial"
  109.          charset         =   0
  110.          weight          =   400
  111.          size            =   12
  112.          underline       =   0   'False
  113.          italic          =   0   'False
  114.          strikethrough   =   0   'False
  115.       EndProperty
  116.       Height          =   495
  117.       Left            =   2640
  118.       TabIndex        =   6
  119.       Top             =   1080
  120.       Width           =   4575
  121.    End
  122.    Begin VB.Label Label4 
  123.       Alignment       =   1  'Right Justify
  124.       Caption         =   "TIME"
  125.       BeginProperty Font 
  126.          name            =   "Arial"
  127.          charset         =   0
  128.          weight          =   400
  129.          size            =   12
  130.          underline       =   0   'False
  131.          italic          =   0   'False
  132.          strikethrough   =   0   'False
  133.       EndProperty
  134.       Height          =   375
  135.       Left            =   240
  136.       TabIndex        =   5
  137.       Top             =   1920
  138.       Width           =   2055
  139.    End
  140.    Begin VB.Label Label2 
  141.       Alignment       =   1  'Right Justify
  142.       Caption         =   "HOST ADDRESS"
  143.       BeginProperty Font 
  144.          name            =   "Arial"
  145.          charset         =   0
  146.          weight          =   400
  147.          size            =   12
  148.          underline       =   0   'False
  149.          italic          =   0   'False
  150.          strikethrough   =   0   'False
  151.       EndProperty
  152.       Height          =   375
  153.       Left            =   240
  154.       TabIndex        =   4
  155.       Top             =   1200
  156.       Width           =   2055
  157.    End
  158.    Begin VB.Label Label1 
  159.       Alignment       =   1  'Right Justify
  160.       Caption         =   "TIME HOST NAME"
  161.       BeginProperty Font 
  162.          name            =   "Arial"
  163.          charset         =   0
  164.          weight          =   400
  165.          size            =   12
  166.          underline       =   0   'False
  167.          italic          =   0   'False
  168.          strikethrough   =   0   'False
  169.       EndProperty
  170.       Height          =   375
  171.       Left            =   240
  172.       TabIndex        =   1
  173.       Top             =   480
  174.       Width           =   2055
  175.    End
  176. Attribute VB_Name = "Form1"
  177. Attribute VB_Creatable = False
  178. Attribute VB_Exposed = False
  179. Const CONNECTING = 1
  180. Const SENDING_REQUEST = 2
  181. Const WAITING_FOR_RESPONSE = 3
  182. Const RECEIVING_INFORMATION = 4
  183. Const WAITING_FOR_ACTION = 5
  184. Sub DispErrMsg(errorvalue As Long)
  185.         MsgBox Str(errorvalue)
  186. End Sub
  187. Private Sub Command1_Click()
  188.     GetAdrs1.HostName = Text1.Text
  189. End Sub
  190. Private Sub Command2_Click()
  191.     If Timer1.Enabled = True Then
  192.         Timer1.Enabled = False
  193.         Command2.Caption = "Enable Timer"
  194.     Else
  195.         Timer1.Enabled = True
  196.         Command2.Caption = "Disable Timer"
  197.     End If
  198. End Sub
  199. Private Sub Form_Load()
  200.     Command2.Caption = "Enable Timer"
  201.     Timer1.Enabled = False
  202. End Sub
  203. Private Sub GetAdrs1_EndGetHostAddress(ByVal IPAddress As String, ByVal ErrorNumber As Integer)
  204.     Time1.HostAddress = IPAddress
  205.     'Or the operation can be sequential
  206.     'MsgBox Time1.GetTime(IPAddress)
  207.     Label5.Caption = IPAddress + " / " + Str(ErrorNumber)
  208. End Sub
  209. Private Sub Time1_EndGetTime(ByVal GMTTime As String, ByVal ErrorNum As Integer)
  210.     Text4.Text = GMTTime + " / " + Str(ErrorNumber)
  211. End Sub
  212. Private Sub Timer1_Timer()
  213.     Command1_Click
  214.     Select Case Time1.CurrentState
  215.     Case CONNECTING: label3.Caption = "Connecting"
  216.     Case SENDING_REQUEST: label3.Caption = "Requesting"
  217.     Case WAITING_FOR_RESPONSE: label3.Caption = "Waiting"
  218.     Case RECEIVING_INFORMATION: label3.Caption = "Receiving"
  219.     Case WAITING_FOR_ACTION: label3.Caption = "No Operation"
  220.     End Select
  221. End Sub
  222.